#include <stdio.h>
int main()
{
   int n,a,b,j;
   for (;;)
   {
     scanf("%d",&n);
     if (n==0)break;
     a=0;
     for (j=0;j<n;j++)
     {
        scanf("%d",&b);
        a+=b;
     }
     printf("%d\n",a);
   }
   return 0;
}